using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using BLL;
using BLL.Impl;

namespace WebUI.Custom
{
    public partial class CarriersByCustom :BasicPage
    {
        private ICustomManager customManger;
        
        private Model.Custom custom;
        protected void Page_Load(object sender, EventArgs e)
        {

            if (null == Session["Custom"])
            {
                Response.Redirect("~/Custom/Login.aspx");
            }
            custom = (Model.Custom)Session["Custom"];
            customManger = BLLFactory.CreateCustomManager();
            if (!IsPostBack)
            {
                Display();
            }
        }

        private void Display()
        {
            Model.CustomCargo  cargo= new Model.CustomCargo();
            cargo.Custom = custom;
            this.gvwCarriersList.DataSource = customManger.SelectCargo(cargo);
            this.gvwCarriersList.DataBind();
        }

        protected void gvwCarriersList_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            this.gvwCarriersList.PageIndex = e.NewPageIndex;
            Display();
        }
    }
}
